package com.sugar.real.estate.module.business.dal.mysql.user;

import java.util.*;

import com.sugar.real.estate.framework.common.pojo.PageResult;
import com.sugar.real.estate.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.real.estate.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.real.estate.module.business.dal.dataobject.user.BizUserDO;
import org.apache.ibatis.annotations.Mapper;
import com.sugar.real.estate.module.business.controller.admin.user.vo.*;

/**
 * 用户 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface BizUserMapper extends BaseMapperX<BizUserDO> {

    default PageResult<BizUserDO> selectPage(BizUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizUserDO>()
                .likeIfPresent(BizUserDO::getNickname, reqVO.getNickname())
                .eqIfPresent(BizUserDO::getMobile, reqVO.getMobile())
                .betweenIfPresent(BizUserDO::getLastLoginTime, reqVO.getLastLoginTime())
                .betweenIfPresent(BizUserDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BizUserDO::getId));
    }

}